【基础教程】Matlab创建三维箱线图 您所在的位置:网站首页 matlab 箱图 【基础教程】Matlab创建三维箱线图

【基础教程】Matlab创建三维箱线图

2023-07-17 09:37| 来源: 网络整理| 查看: 265

 主要介绍箱线图(Box-plot)和利用Matlab绘制箱线图。

1、箱线图介绍

统计指标一般包括:四分位数、均值、中位数、众数、方差、标准差等,箱线图作为一种数据统计的方法,内容包括:最小值,第一分位,中位数,第三分位数,最大值。在这里插入图片描述

箱线图于1977年由美国著名统计学家约翰·图基(John Tukey)发明,能够明确的展示离群点的信息,同时能够让我们了解数据是否对称,数据如何分组、数据的峰度。

箱线图(Box-plot)是一种用于显示一组数据分散情况的统计图,多用于多组数据的比较,相对于直方图,既可以节省空间,还可以展示更多信息(如均值、四分位数等)。

箱线图包含数学统计量,能够分析不同类别数据各层次水平差异,还可以揭示数据间离散程度、异常值、分布差异等。

箱线图内容详细介绍:在这里插入图片描述 【注】图片来自你似乎来到了没有知识存在的荒原 - 知乎

四分位数: 一组数据按照从小到大顺序排列后,把该组数据四等分的数,称为四分位数。第一四分位数 (Q1)、第二四分位数 (Q2,也叫“中位数”)和第三四分位数 (Q3)分别等于该样本中所有数值由小到大排列后第25%、第50%和第75%的数字。第三四分位数与第一四分位数的差距又称四分位距(interquartile range, IQR)。

(1)第一个四分位数Q1:也称作25th百分位数,表示最小数(不是“最小值”)和数据集的中位数之间的中间数。

(2)第二四分位数Q2:也称作中位数Median/50th百分位数,表示数据集的中间值。

(3)第三四分位数Q3:也称作75th百分位数,表示数据集的中位数和最大值之间的中间值(不是“最大值”)。

(4)四分位间距IQR:第25至第75个百分点的距离。

(5)离群值:Outliers

(6)最大值max、最小值min

利用正态分布的箱线图,可以帮助理解箱线图:在这里插入图片描述 【注】图片来自你似乎来到了没有知识存在的荒原 - 知乎

2 完整代码

function boxPlot3D(xx,g1,g2,quantDistribution) %function boxPlot3D(xx,g1,g2,quantDistribution) %-------------------------------------------------------------------------- % boxPlot3D(x) creates a three dimensional box plot of the data in x. If x % is 3D a matrix, boxPlot3D creates one box for each column. Example, % create a 3D matrix with normal distributions with different means: % % xx=randn(50,2,4)+repmat((permute([0 1 2 -2;1 2 3 4],[3 1 2])),[50,1,1]); % boxPlot3D(xx) % % boxPlot3D(x,g1,g2) groups the data of x, with the grouping variables of % g1, and g2. Example, create a 1D Matrix with different values and the % corresponding grouping parameters: % % xx=randn(500,1)+linspace(0,5,500)'; % g1= [0.1*ones(250,1);0.2*ones(250,1)]; % g2= [3*ones(150,1);4*ones(150,1);5*ones(200,1)]; % boxPlot3D(xx,g1,g2) % % boxPlot3D(x,[],[],quantDistribution) allows the selection of the % quantiles to select, e.g. [0 0.25 0.5 0.75 1] %    [0 0.25 0.5 0.75 1] (default)  creates a box between 0.25 and 0.75 %                         with a line in 0.5 and two planes at 0 and 1 %                         connected with a dashed line. These values can be %                         changed. %    [ 0 1]               creates a box within the extremes of the values %                          selected. These values can be changed, e.g. %                          [0.25 0.75] %    [ 0.25 0.5 0.75]     creates a box and a line, same as the option with %                         5 values, but will not draw the planes with the %                         dashed line. % The colours of the boxes can be changed in the code. %-------------------------------------------------------------------------- % %

if nargin



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有